package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysContractRefundLogMapper;
import com.ruoyi.system.domain.SysContractRefundLog;
import com.ruoyi.system.service.ISysContractRefundLogService;

/**
 * 退费合同操作日志Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-29
 */
@Service
public class SysContractRefundLogServiceImpl implements ISysContractRefundLogService
{
    @Autowired
    private SysContractRefundLogMapper sysContractRefundLogMapper;

    /**
     * 查询退费合同操作日志
     *
     * @param id 退费合同操作日志主键
     * @return 退费合同操作日志
     */
    @Override
    public SysContractRefundLog selectSysContractRefundLogById(Long id)
    {
        return sysContractRefundLogMapper.selectSysContractRefundLogById(id);
    }

    /**
     * 查询退费合同操作日志列表
     *
     * @param sysContractRefundLog 退费合同操作日志
     * @return 退费合同操作日志
     */
    @Override
    public List<SysContractRefundLog> selectSysContractRefundLogList(SysContractRefundLog sysContractRefundLog)
    {
        return sysContractRefundLogMapper.selectSysContractRefundLogList(sysContractRefundLog);
    }

    /**
     * 根据合同主键查询合同日志
     * @param refundId
     * @return
     */
    @Override
    public List<SysContractRefundLog> selectSysContractRefundLogListByRefundId(Long refundId) {
        return sysContractRefundLogMapper.selectSysContractRefundLogListByRefundId(refundId);
    }

    /**
     * 新增退费合同操作日志
     *
     * @param sysContractRefundLog 退费合同操作日志
     * @return 结果
     */
    @Override
    public int insertSysContractRefundLog(SysContractRefundLog sysContractRefundLog)
    {
        sysContractRefundLog.setCreateTime(DateUtils.getNowDate());
        return sysContractRefundLogMapper.insertSysContractRefundLog(sysContractRefundLog);
    }

    /**
     * 修改退费合同操作日志
     *
     * @param sysContractRefundLog 退费合同操作日志
     * @return 结果
     */
    @Override
    public int updateSysContractRefundLog(SysContractRefundLog sysContractRefundLog)
    {
        return sysContractRefundLogMapper.updateSysContractRefundLog(sysContractRefundLog);
    }

    /**
     * 批量删除退费合同操作日志
     *
     * @param ids 需要删除的退费合同操作日志主键
     * @return 结果
     */
    @Override
    public int deleteSysContractRefundLogByIds(Long[] ids)
    {
        return sysContractRefundLogMapper.deleteSysContractRefundLogByIds(ids);
    }

    /**
     * 删除退费合同操作日志信息
     *
     * @param id 退费合同操作日志主键
     * @return 结果
     */
    @Override
    public int deleteSysContractRefundLogById(Long id)
    {
        return sysContractRefundLogMapper.deleteSysContractRefundLogById(id);
    }

    /**
     * 构建合同退费日志实体
     * @param sysContractRefundLog
     * @return
     */
    @Override
    public SysContractRefundLog buildSysContractRefundLog(SysContractRefundLog sysContractRefundLog) {
        //创建人
        sysContractRefundLog.setCreateBy(SecurityUtils.getUsername());
        //创建时间
        sysContractRefundLog.setCreateTime(DateUtils.getNowDate());
        return sysContractRefundLog;
    }

    /**
     * 根据退费合同删除退费合同日志
     * @param refundId
     * @return
     */
    @Override
    public int deleteSysContractRefundLogByRefundId(Long refundId) {
        return sysContractRefundLogMapper.deleteSysContractRefundLogByRefundId(refundId);
    }
}